package com.chen.adapter;

import java.util.ArrayList;
import java.util.List;

import com.chen.sql.Question;

import gui.view.View;
import gui.view.ViewGroup;
import gui.view.adapter.BaseAdapter;

public class ListAdapter extends BaseAdapter {

	private List<Question> data = new ArrayList<>();

	public void setData(List<Question> data) {
		this.data = data;
		notifyDataSetChanged();
	}

	public void addData(List<Question> data) {
		this.data.addAll(data);
		notifyDataSetChanged();
	}

	public Question getData(int index) {
		return data.get(index);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return getData(position).getId();
	}

	@Override
	public String getItem(int position) {
		return getData(position).getTitle();
	}

	@Override
	public int getCount() {
		return data.size();
	}
}
